package com.cms.cmsbackend.controller;

import com.cms.cmsbackend.pojo.Link;
import com.cms.cmsbackend.service.LinkService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags="链接管理")
public class LinkController {
    @Autowired
    private LinkService linkService;
    @PostMapping("/link/add")
    @ApiOperation("链接新增")
    public String add(Link link){
        linkService.save(link);
        return "数据新增成功";
    }
    @GetMapping("/link/delete")
    @ApiOperation("链接删减")
    public String delete(int id){
        linkService.remove(id);
        return "数据删除成功";
    }
    public String update(Link link){
        linkService.update(link);
        return "数据更新成功";
    }
}
